﻿using System;
using System.Globalization;
using System.Windows;
using System.Windows.Data;

namespace Phoenix.Xna.Framework.Presentation.Converters
{
    [ValueConversion(typeof(string), typeof(Visibility))]
    public class EffectParameterEditVisibilityConverter : IValueConverter
    {
        #region IValueConverter Members

        /// <summary>
        /// Converts an object reference to a System.Windows.Visibility value.
        /// </summary>
        /// <param name="value">The value produced by the binding source.</param>
        /// <param name="targetType">The type of the binding target property.</param>
        /// <param name="parameter">The converter parameter to use.</param>
        /// <param name="culture">The culture to use in the converter.</param>
        /// <returns>Visiblility.Visible if != null, otherwise Visibility.Hidden.</returns>
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            string type = (string)value;

            switch (type)
	        {
                case "Matrix":
                case "Texture":
                case "Texture2D":
                    return Visibility.Visible;
                default:
                    return Visibility.Hidden;
	        }
        }

        /// <summary>
        /// This method is not implemented.
        /// </summary>
        /// <param name="value">The value produced by the binding target.</param>
        /// <param name="targetType">The type to convert to.</param>
        /// <param name="parameter">The converter parameter to use.</param>
        /// <param name="culture">The culture to use in the converter.</param>
        /// <returns>This method is not implemented.</returns>
        /// <exception cref="NotImplementedException">This method is not implemented.</exception>
        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }

        #endregion
    }
}
